/*+***********************************************************************************
 Filename: hal_basic.h
 Description:
   Basic HAL functions for my TangPrimer20kDock based mcu. (03_mcu_sparrowrvcore_02)

 Modification:
   2024.05.25 Creation    H.Zheng
   2025.08.17 modified for 9k_mcu01_mycore_v01 (no interrupt; add delayMs())

Copyright (C) 2024-2025  Zheng Hui (hzheng@gzhu.edu.cn)

License: MulanPSL-2.0

***********************************************************************************-*/
#ifndef HAL_BASIC_H
#define HAL_BASIC_H

/**
 * clk freq of hardware
 */
#define SYSTEM_CLOCK_FREQ 27000000

/**
 * GPIO
 */
void setLedValue(unsigned int vValue);

unsigned int getLedValue();

int buttonPushed();

/**
 * TIMER
 */
void setTimerTopValue(unsigned int vValue);

void startTimer();

unsigned int getTimeoutFlag();
void delayMs(unsigned int period);
/**
 * UART
 */
void uartSend(unsigned int vData);

void uartSendStr(const char *str);

//blocking function: return until receive byte
unsigned int uartReceive();

unsigned int getUartRxFlag();

#endif
